<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class mgamecategory extends MY_Model {

    var $theme_data = array(
        'layout_main' => 'layout',
        'left' => 'include/leftcp',
    );
    public $mytable = "game_category";
    public $primaryKey = "gcat_id";
    public $resCode = "GAME_CATEGORY";

    function __construct() {
        parent::__construct();
    }

    function field() {
		$fieldData = array();
		$fieldData['cat_id'] = 0;
		$fieldData['game_id'] = 0;
		return $fieldData;
    }
	
	function insert_category_by_gameid($game_id = 0, $arr_cate = array()){
		if($game_id >0 && is_array($arr_cate) && count($arr_cate)>0){
			$arr_cate_insert = array();
			foreach($arr_cate as $cat_id)
			{
				$arr_cate_insert[] = array('game_id'=>$game_id, 'cat_id'=>$cat_id); 
			}
			$this->db->insert_batch($this->mytable, $arr_cate_insert);
			return 1;
		}
		return 0;
	}
	
}

?>